﻿/*
版权所有：版权所有(C) 2011，刘建新
文件编号：M01_Products.cs
文件名称：Purchase.cs
系统编号：Z0003007
系统名称：通用办公系统
模块编号：M01
模块名称：信息发布
设计文档：IOA_M01信息发布XDE建模.mdx
完成日期：2011/1/21
作　　者：
内容摘要：表[Purchase]对应的实体类
*/

using System;
using System.Collections;
using System.Data;


namespace Eis51.CampanyCMS.Model.Bus
{
    /// <summary>
    /// 类 编 号：
    /// 类 名 称：Purchase
    /// 内容摘要：
    /// </summary>

    [Serializable]
    public class Purchase : BaseModel
    {
        #region 自动生成代码

        #region 重载Equals/GetHashCode
        /// <summary>
        /// 重载Equals			
        /// </summary>
        public override bool Equals(Object obj)
        {
            if (obj != null && obj is Purchase)
            {
                if (obj == this)
                    return true;
                Purchase castObj = (Purchase)obj;

                if (!this.m_Seqno.Equals(castObj.Seqno))
                    return false;

                if (!this.m_ProductID.Equals(castObj.ProductID))
                    return false;

                if (!this.m_Title.Equals(castObj.Title))
                    return false;

                if (!this.m_Type.Equals(castObj.Type))
                    return false;

                if (!this.m_Descr.Equals(castObj.Descr))
                    return false;

                if (!this.m_Feature.Equals(castObj.Feature))
                    return false;

                if (!this.m_Shortdescr.Equals(castObj.Shortdescr))
                    return false;

                if (!this.m_Price.Equals(castObj.Price))
                    return false;

                if (!this.m_Nowprice.Equals(castObj.Nowprice))
                    return false;

                if (!this.m_Sore.Equals(castObj.Sore))
                    return false;

                if (!this.m_Keyword.Equals(castObj.Keyword))
                    return false;

                if (!this.m_Isfirst.Equals(castObj.Isfirst))
                    return false;

                if (!this.m_Level.Equals(castObj.Level))
                    return false;

                if (!this.m_Createby.Equals(castObj.Createby))
                    return false;

                if (!this.m_Createdate.Equals(castObj.Createdate))
                    return false;

                if (!this.m_Lasteupdateby.Equals(castObj.Lasteupdateby))
                    return false;

                if (!this.m_Lasteupdatedate.Equals(castObj.Lasteupdatedate))
                    return false;

                if (!this.m_Licd.Equals(castObj.Licd))
                    return false;

                if (!this.m_ImgBigPath.Equals(castObj.ImgBigPath))
                    return false;

                if (!this.m_ImgSmaillPath.Equals(castObj.ImgSmaillPath))
                    return false;

                if (!this.m_FileListId.Equals(castObj.FileListId))
                    return false;

                if (!this.m_Code.Equals(castObj.Code))
                    return false;

                if (!this.m_MailPrice.Equals(castObj.MailPrice))
                    return false;

                if (!this.m_Stocks.Equals(castObj.Stocks))
                    return false;

                if (!this.m_Indeximg.Equals(castObj.Indeximg))
                    return false;

                if (!this.m_Otherdescr.Equals(castObj.Otherdescr))
                    return false;

                return true;
            }
            return false;
        }

        /// <summary>
        /// 重载GetHashCode
        /// </summary>
        public override int GetHashCode()
        {
            int hash = 0;

            hash = hash << 8;
            if ((object)m_Seqno != null)
            {
                hash = hash ^ m_Seqno.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Title != null)
            {
                hash = hash ^ m_Title.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Type != null)
            {
                hash = hash ^ m_Type.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Descr != null)
            {
                hash = hash ^ m_Descr.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Feature != null)
            {
                hash = hash ^ m_Feature.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Shortdescr != null)
            {
                hash = hash ^ m_Shortdescr.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Price != null)
            {
                hash = hash ^ m_Price.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Nowprice != null)
            {
                hash = hash ^ m_Nowprice.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Sore != null)
            {
                hash = hash ^ m_Sore.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Keyword != null)
            {
                hash = hash ^ m_Keyword.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Isfirst != null)
            {
                hash = hash ^ m_Isfirst.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Level != null)
            {
                hash = hash ^ m_Level.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Createby != null)
            {
                hash = hash ^ m_Createby.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Createdate != null)
            {
                hash = hash ^ m_Createdate.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Lasteupdateby != null)
            {
                hash = hash ^ m_Lasteupdateby.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Lasteupdatedate != null)
            {
                hash = hash ^ m_Lasteupdatedate.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Licd != null)
            {
                hash = hash ^ m_Licd.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_ImgBigPath != null)
            {
                hash = hash ^ m_ImgBigPath.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_ImgSmaillPath != null)
            {
                hash = hash ^ m_ImgSmaillPath.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_FileListId != null)
            {
                hash = hash ^ m_FileListId.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Code != null)
            {
                hash = hash ^ m_Code.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_MailPrice != null)
            {
                hash = hash ^ m_MailPrice.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Stocks != null)
            {
                hash = hash ^ m_Stocks.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Indeximg != null)
            {
                hash = hash ^ m_Indeximg.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Otherdescr != null)
            {
                hash = hash ^ m_Otherdescr.GetHashCode();
            }

            return hash;
        }
        #endregion

        public Purchase()
        {
            MarkNew();
        }

        public Purchase GetOldValue()
        {
            return OldValue as Purchase;
        }

        #region Seqno属性
        private int m_Seqno = 0;
        /// <summary>
        /// 属性名称： Seqno
        /// 内容摘要： DB列名：Seqno[]
        ///            DB类型：int
        /// </summary>
        public int Seqno
        {
            get
            {
                return m_Seqno;
            }
            set
            {
                if (m_Seqno as object == null || !m_Seqno.Equals(value))
                {
                    m_Seqno = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region ProductID属性
        private int m_ProductID = 0;
        /// <summary>
        /// 属性名称： Seqno
        /// 内容摘要： DB列名：Seqno[]
        ///            DB类型：int
        /// </summary>
        public int ProductID
        {
            get
            {
                return m_ProductID;
            }
            set
            {
                if (m_ProductID as object == null || !m_ProductID.Equals(value))
                {
                    m_ProductID = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Title属性
        private string m_Title = String.Empty;
        /// <summary>
        /// 属性名称： Title
        /// 内容摘要： DB列名：Title[名称]
        ///            DB类型：string
        /// </summary>
        public string Title
        {
            get
            {
                return m_Title;
            }
            set
            {
                if (m_Title as object == null || !m_Title.Equals(value))
                {
                    m_Title = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Type属性
        private int m_Type = 0;
        /// <summary>
        /// 属性名称： Type
        /// 内容摘要： DB列名：Type[类型]
        ///            DB类型：int
        /// </summary>
        public int Type
        {
            get
            {
                return m_Type;
            }
            set
            {
                if (m_Type as object == null || !m_Type.Equals(value))
                {
                    m_Type = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Descr属性
        private string m_Descr = String.Empty;
        /// <summary>
        /// 属性名称： Descr
        /// 内容摘要： DB列名：Descr[产品中文描述]
        ///            DB类型：string
        /// </summary>
        public string Descr
        {
            get
            {
                return m_Descr;
            }
            set
            {
                if (m_Descr as object == null || !m_Descr.Equals(value))
                {
                    m_Descr = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Feature属性
        private string m_Feature = String.Empty;
        /// <summary>
        /// 属性名称： Feature
        /// 内容摘要： DB列名：feature[产品的特色英文描述]
        ///            DB类型：string
        /// </summary>
        public string Feature
        {
            get
            {
                return m_Feature;
            }
            set
            {
                if (m_Feature as object == null || !m_Feature.Equals(value))
                {
                    m_Feature = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Shortdescr属性
        private string m_Shortdescr = String.Empty;
        /// <summary>
        /// 属性名称： Shortdescr
        /// 内容摘要： DB列名：ShortDescr[简短描述]
        ///            DB类型：string
        /// </summary>
        public string Shortdescr
        {
            get
            {
                return m_Shortdescr;
            }
            set
            {
                if (m_Shortdescr as object == null || !m_Shortdescr.Equals(value))
                {
                    m_Shortdescr = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Price属性
        private double m_Price = 0;
        /// <summary>
        /// 属性名称： Price
        /// 内容摘要： DB列名：price[市场价]
        ///            DB类型：double
        /// </summary>
        public double Price
        {
            get
            {
                return m_Price;
            }
            set
            {
                if (m_Price as object == null || !m_Price.Equals(value))
                {
                    m_Price = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Nowprice属性
        private double m_Nowprice = 0;
        /// <summary>
        /// 属性名称： Nowprice
        /// 内容摘要： DB列名：Nowprice[真实价]
        ///            DB类型：double
        /// </summary>
        public double Nowprice
        {
            get
            {
                return m_Nowprice;
            }
            set
            {
                if (m_Nowprice as object == null || !m_Nowprice.Equals(value))
                {
                    m_Nowprice = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Sore属性
        private double m_Sore = 0;
        /// <summary>
        /// 属性名称： Sore
        /// 内容摘要： DB列名：Sore[评分]
        ///            DB类型：double
        /// </summary>
        public double Sore
        {
            get
            {
                return m_Sore;
            }
            set
            {
                if (m_Sore as object == null || !m_Sore.Equals(value))
                {
                    m_Sore = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Keyword属性
        private string m_Keyword = String.Empty;
        /// <summary>
        /// 属性名称： Keyword
        /// 内容摘要： DB列名：KeyWord[关键字]
        ///            DB类型：string
        /// </summary>
        public string Keyword
        {
            get
            {
                return m_Keyword;
            }
            set
            {
                if (m_Keyword as object == null || !m_Keyword.Equals(value))
                {
                    m_Keyword = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Isfirst属性
        private int m_Isfirst = 0;
        /// <summary>
        /// 属性名称： Isfirst
        /// 内容摘要： DB列名：Isfirst[是否首页]
        ///            DB类型：int
        /// </summary>
        public int Isfirst
        {
            get
            {
                return m_Isfirst;
            }
            set
            {
                if (m_Isfirst as object == null || !m_Isfirst.Equals(value))
                {
                    m_Isfirst = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Level属性
        private int m_Level = 0;
        /// <summary>
        /// 属性名称： Level
        /// 内容摘要： DB列名：Level[级别]
        ///            DB类型：int
        /// </summary>
        public int Level
        {
            get
            {
                return m_Level;
            }
            set
            {
                if (m_Level as object == null || !m_Level.Equals(value))
                {
                    m_Level = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Createby属性
        private string m_Createby = String.Empty;
        /// <summary>
        /// 属性名称： Createby
        /// 内容摘要： DB列名：Createby[发布时间]
        ///            DB类型：string
        /// </summary>
        public string Createby
        {
            get
            {
                return m_Createby;
            }
            set
            {
                if (m_Createby as object == null || !m_Createby.Equals(value))
                {
                    m_Createby = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Createdate属性
        private DateTime m_Createdate = new DateTime(1900, 1, 1);
        /// <summary>
        /// 属性名称： Createdate
        /// 内容摘要： DB列名：CreateDate[]
        ///            DB类型：DateTime
        /// </summary>
        public DateTime Createdate
        {
            get
            {
                return DateTime.Parse(m_Createdate.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            set
            {
                if (m_Createdate as object == null || !m_Createdate.Equals(value))
                {
                    m_Createdate = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Lasteupdateby属性
        private string m_Lasteupdateby = String.Empty;
        /// <summary>
        /// 属性名称： Lasteupdateby
        /// 内容摘要： DB列名：LasteUpdateby[]
        ///            DB类型：string
        /// </summary>
        public string Lasteupdateby
        {
            get
            {
                return m_Lasteupdateby;
            }
            set
            {
                if (m_Lasteupdateby as object == null || !m_Lasteupdateby.Equals(value))
                {
                    m_Lasteupdateby = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Lasteupdatedate属性
        private DateTime m_Lasteupdatedate = new DateTime(1900, 1, 1);
        /// <summary>
        /// 属性名称： Lasteupdatedate
        /// 内容摘要： DB列名：LasteUpdateDate[]
        ///            DB类型：DateTime
        /// </summary>
        public DateTime Lasteupdatedate
        {
            get
            {
                return DateTime.Parse(m_Lasteupdatedate.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            set
            {
                if (m_Lasteupdatedate as object == null || !m_Lasteupdatedate.Equals(value))
                {
                    m_Lasteupdatedate = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Licd属性
        private int m_Licd = 0;
        /// <summary>
        /// 属性名称： Licd
        /// 内容摘要： DB列名：Licd[]
        ///            DB类型：int
        /// </summary>
        public int Licd
        {
            get
            {
                return m_Licd;
            }
            set
            {
                if (m_Licd as object == null || !m_Licd.Equals(value))
                {
                    m_Licd = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region ImgBigPath属性
        private string m_ImgBigPath = String.Empty;
        /// <summary>
        /// 属性名称： ImgBigPath
        /// 内容摘要： DB列名：Img_Big_Path[只保留文件名]
        ///            DB类型：string
        /// </summary>
        public string ImgBigPath
        {
            get
            {
                return m_ImgBigPath;
            }
            set
            {
                if (m_ImgBigPath as object == null || !m_ImgBigPath.Equals(value))
                {
                    m_ImgBigPath = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region ImgSmaillPath属性
        private string m_ImgSmaillPath = String.Empty;
        /// <summary>
        /// 属性名称： ImgSmaillPath
        /// 内容摘要： DB列名：Img_Smaill_Path[只保留文件名]
        ///            DB类型：string
        /// </summary>
        public string ImgSmaillPath
        {
            get
            {
                return m_ImgSmaillPath;
            }
            set
            {
                if (m_ImgSmaillPath as object == null || !m_ImgSmaillPath.Equals(value))
                {
                    m_ImgSmaillPath = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region FileListId属性
        private int m_FileListId = 0;
        /// <summary>
        /// 属性名称： FileListId
        /// 内容摘要： DB列名：File_List_ID[文件表ID，用于对应默认图片]
        ///            DB类型：int
        /// </summary>
        public int FileListId
        {
            get
            {
                return m_FileListId;
            }
            set
            {
                if (m_FileListId as object == null || !m_FileListId.Equals(value))
                {
                    m_FileListId = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Code属性
        private string m_Code = String.Empty;
        /// <summary>
        /// 属性名称： Code
        /// 内容摘要： DB列名：Code[代码]
        ///            DB类型：string
        /// </summary>
        public string Code
        {
            get
            {
                return m_Code;
            }
            set
            {
                if (m_Code as object == null || !m_Code.Equals(value))
                {
                    m_Code = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region MailPrice属性
        private double m_MailPrice = 0;
        /// <summary>
        /// 属性名称： MailPrice
        /// 内容摘要： DB列名：Mail_Price[邮寄方式]
        ///            DB类型：double
        /// </summary>
        public double MailPrice
        {
            get
            {
                return m_MailPrice;
            }
            set
            {
                if (m_MailPrice as object == null || !m_MailPrice.Equals(value))
                {
                    m_MailPrice = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Stocks属性
        private int m_Stocks = 0;
        /// <summary>
        /// 属性名称： Stocks
        /// 内容摘要： DB列名：Stocks[库存]
        ///            DB类型：int
        /// </summary>
        public int Stocks
        {
            get
            {
                return m_Stocks;
            }
            set
            {
                if (m_Stocks as object == null || !m_Stocks.Equals(value))
                {
                    m_Stocks = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Indeximg属性
        private string m_Indeximg = String.Empty;
        /// <summary>
        /// 属性名称： Indeximg
        /// 内容摘要： DB列名：Indeximg[]
        ///            DB类型：string
        /// </summary>
        public string Indeximg
        {
            get
            {
                return m_Indeximg;
            }
            set
            {
                if (m_Indeximg as object == null || !m_Indeximg.Equals(value))
                {
                    m_Indeximg = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Otherdescr属性
        private string m_Otherdescr = String.Empty;
        /// <summary>
        /// 属性名称： Otherdescr
        /// 内容摘要： DB列名：OtherDescr[]
        ///            DB类型：string
        /// </summary>
        public string Otherdescr
        {
            get
            {
                return m_Otherdescr;
            }
            set
            {
                if (m_Otherdescr as object == null || !m_Otherdescr.Equals(value))
                {
                    m_Otherdescr = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region static CreateDataTable/FillDataRow/DataRow2Obj/Dt2Objs/FillDataTable
        /// <summary>
        /// 得到实体对应的DataTable
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="cne">列名映射选择:DB列名或属性名</param>
        /// <returns>生成的DataTable</returns>
        static public DataTable CreateDataTable(string tableName, ColumnNameEnum cne)
        {
            DataTable dtResult = new DataTable(tableName);

            if (cne == ColumnNameEnum.DBName)
            {
                dtResult.Columns.Add(new DataColumn("Seqno", typeof(int)));
                dtResult.Columns.Add(new DataColumn("ProductID", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Title", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Type", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Descr", typeof(string)));
                dtResult.Columns.Add(new DataColumn("feature", typeof(string)));
                dtResult.Columns.Add(new DataColumn("ShortDescr", typeof(string)));
                dtResult.Columns.Add(new DataColumn("price", typeof(double)));
                dtResult.Columns.Add(new DataColumn("Nowprice", typeof(double)));
                dtResult.Columns.Add(new DataColumn("Sore", typeof(double)));
                dtResult.Columns.Add(new DataColumn("KeyWord", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Isfirst", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Level", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Createby", typeof(string)));
                dtResult.Columns.Add(new DataColumn("CreateDate", typeof(DateTime)));
                dtResult.Columns.Add(new DataColumn("LasteUpdateby", typeof(string)));
                dtResult.Columns.Add(new DataColumn("LasteUpdateDate", typeof(DateTime)));
                dtResult.Columns.Add(new DataColumn("Licd", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Img_Big_Path", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Img_Smaill_Path", typeof(string)));
                dtResult.Columns.Add(new DataColumn("File_List_ID", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Code", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Mail_Price", typeof(double)));
                dtResult.Columns.Add(new DataColumn("Stocks", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Indeximg", typeof(string)));
                dtResult.Columns.Add(new DataColumn("OtherDescr", typeof(string)));
            }
            else if (cne == ColumnNameEnum.PropertyName)
            {
                dtResult.Columns.Add(new DataColumn("Seqno", typeof(int)));
                dtResult.Columns.Add(new DataColumn("ProductID", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Title", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Type", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Descr", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Feature", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Shortdescr", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Price", typeof(double)));
                dtResult.Columns.Add(new DataColumn("Nowprice", typeof(double)));
                dtResult.Columns.Add(new DataColumn("Sore", typeof(double)));
                dtResult.Columns.Add(new DataColumn("Keyword", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Isfirst", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Level", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Createby", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Createdate", typeof(DateTime)));
                dtResult.Columns.Add(new DataColumn("Lasteupdateby", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Lasteupdatedate", typeof(DateTime)));
                dtResult.Columns.Add(new DataColumn("Licd", typeof(int)));
                dtResult.Columns.Add(new DataColumn("ImgBigPath", typeof(string)));
                dtResult.Columns.Add(new DataColumn("ImgSmaillPath", typeof(string)));
                dtResult.Columns.Add(new DataColumn("FileListId", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Code", typeof(string)));
                dtResult.Columns.Add(new DataColumn("MailPrice", typeof(double)));
                dtResult.Columns.Add(new DataColumn("Stocks", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Indeximg", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Otherdescr", typeof(string)));
            }
            return dtResult;
        }

        /// <summary>
        /// 得到实体对应的DataTable
        /// </summary>
        /// <param name="cne">列名映射选择:DB列名或属性名</param>
        /// <returns>生成的DataTable</returns>
        static public DataTable CreateDataTable(ColumnNameEnum cne)
        {
            return CreateDataTable(null, cne);
        }

        /// <summary>
        /// 得到实体对应的DataTable(默认列名映射为属性名)
        /// </summary>
        /// <returns>生成的DataTable</returns>
        static public DataTable CreateDataTable()
        {
            return CreateDataTable(ColumnNameEnum.PropertyName);
        }

        /// <summary>
        /// 用当前对象值填充DaraRow
        /// </summary>
        /// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
        /// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
        public void FillDataRow(DataRow dr, ColumnNameEnum cne)
        {
            if (dr == null)
            {
                throw new ArgumentNullException("dr");
            }
            if (ColumnNameEnum.DBName == cne)
            {
                dr["Seqno"] = this.Seqno;
                dr["ProductID"] = this.ProductID;
                dr["Title"] = this.Title;
                dr["Type"] = this.Type;
                dr["Descr"] = this.Descr;
                dr["feature"] = this.Feature;
                dr["ShortDescr"] = this.Shortdescr;
                dr["price"] = this.Price;
                dr["Nowprice"] = this.Nowprice;
                dr["Sore"] = this.Sore;
                dr["KeyWord"] = this.Keyword;
                dr["Isfirst"] = this.Isfirst;
                dr["Level"] = this.Level;
                dr["Createby"] = this.Createby;
                dr["CreateDate"] = this.Createdate;
                dr["LasteUpdateby"] = this.Lasteupdateby;
                dr["LasteUpdateDate"] = this.Lasteupdatedate;
                dr["Licd"] = this.Licd;
                dr["Img_Big_Path"] = this.ImgBigPath;
                dr["Img_Smaill_Path"] = this.ImgSmaillPath;
                dr["File_List_ID"] = this.FileListId;
                dr["Code"] = this.Code;
                dr["Mail_Price"] = this.MailPrice;
                dr["Stocks"] = this.Stocks;
                dr["Indeximg"] = this.Indeximg;
                dr["OtherDescr"] = this.Otherdescr;
            }
            else if (ColumnNameEnum.PropertyName == cne)
            {
                dr["Seqno"] = this.Seqno;
                dr["ProductID"] = this.ProductID;
                dr["Title"] = this.Title;
                dr["Type"] = this.Type;
                dr["Descr"] = this.Descr;
                dr["Feature"] = this.Feature;
                dr["Shortdescr"] = this.Shortdescr;
                dr["Price"] = this.Price;
                dr["Nowprice"] = this.Nowprice;
                dr["Sore"] = this.Sore;
                dr["Keyword"] = this.Keyword;
                dr["Isfirst"] = this.Isfirst;
                dr["Level"] = this.Level;
                dr["Createby"] = this.Createby;
                dr["Createdate"] = this.Createdate;
                dr["Lasteupdateby"] = this.Lasteupdateby;
                dr["Lasteupdatedate"] = this.Lasteupdatedate;
                dr["Licd"] = this.Licd;
                dr["ImgBigPath"] = this.ImgBigPath;
                dr["ImgSmaillPath"] = this.ImgSmaillPath;
                dr["FileListId"] = this.FileListId;
                dr["Code"] = this.Code;
                dr["MailPrice"] = this.MailPrice;
                dr["Stocks"] = this.Stocks;
                dr["Indeximg"] = this.Indeximg;
                dr["Otherdescr"] = this.Otherdescr;
            }
        }

        /// <summary>
        /// 用当前对象值填充DaraRow(默认列名映射为属性名)
        /// </summary>
        /// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
        public void FillDataRow(DataRow dr)
        {
            this.FillDataRow(dr, ColumnNameEnum.PropertyName);
        }

        /// <summary>
        /// 将DataRow转换成Purchase对象
        /// </summary>
        /// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
        /// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
        /// <returns>Purchase对象</returns>
        public static Purchase Dr2Obj(DataRow dr, ColumnNameEnum cne)
        {
            if (dr == null)
            {
                throw new ArgumentNullException("dr");
            }
            Purchase obj = new Purchase();
            if (ColumnNameEnum.DBName == cne)
            {
                obj.Seqno = (dr["Seqno"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Seqno"], typeof(int));
                obj.ProductID = (dr["ProductID"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["ProductID"], typeof(int));
                obj.Title = (dr["Title"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Title"], typeof(string));
                obj.Type = (dr["Type"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Type"], typeof(int));
                obj.Descr = (dr["Descr"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Descr"], typeof(string));
                obj.Feature = (dr["feature"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["feature"], typeof(string));
                obj.Shortdescr = (dr["ShortDescr"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["ShortDescr"], typeof(string));
                obj.Price = (dr["price"] == Convert.DBNull) ? 0 : (double)Convert.ChangeType(dr["price"], typeof(double));
                obj.Nowprice = (dr["Nowprice"] == Convert.DBNull) ? 0 : (double)Convert.ChangeType(dr["Nowprice"], typeof(double));
                obj.Sore = (dr["Sore"] == Convert.DBNull) ? 0 : (double)Convert.ChangeType(dr["Sore"], typeof(double));
                obj.Keyword = (dr["KeyWord"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["KeyWord"], typeof(string));
                obj.Isfirst = (dr["Isfirst"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Isfirst"], typeof(int));
                obj.Level = (dr["Level"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Level"], typeof(int));
                obj.Createby = (dr["Createby"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Createby"], typeof(string));
                obj.Createdate = (dr["CreateDate"] == Convert.DBNull) ? new DateTime(1900, 1, 1) : (DateTime)Convert.ChangeType(dr["CreateDate"], typeof(DateTime));
                obj.Lasteupdateby = (dr["LasteUpdateby"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["LasteUpdateby"], typeof(string));
                obj.Lasteupdatedate = (dr["LasteUpdateDate"] == Convert.DBNull) ? new DateTime(1900, 1, 1) : (DateTime)Convert.ChangeType(dr["LasteUpdateDate"], typeof(DateTime));
                obj.Licd = (dr["Licd"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Licd"], typeof(int));
                obj.ImgBigPath = (dr["Img_Big_Path"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Img_Big_Path"], typeof(string));
                obj.ImgSmaillPath = (dr["Img_Smaill_Path"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Img_Smaill_Path"], typeof(string));
                obj.FileListId = (dr["File_List_ID"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["File_List_ID"], typeof(int));
                obj.Code = (dr["Code"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Code"], typeof(string));
                obj.MailPrice = (dr["Mail_Price"] == Convert.DBNull) ? 0 : (double)Convert.ChangeType(dr["Mail_Price"], typeof(double));
                obj.Stocks = (dr["Stocks"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Stocks"], typeof(int));
                obj.Indeximg = (dr["Indeximg"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Indeximg"], typeof(string));
                obj.Otherdescr = (dr["OtherDescr"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["OtherDescr"], typeof(string));
            }
            else if (ColumnNameEnum.PropertyName == cne)
            {
                obj.Seqno = (dr["Seqno"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Seqno"], typeof(int));
                obj.ProductID = (dr["ProductID"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["ProductID"], typeof(int));
                obj.Title = (dr["Title"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Title"], typeof(string));
                obj.Type = (dr["Type"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Type"], typeof(int));
                obj.Descr = (dr["Descr"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Descr"], typeof(string));
                obj.Feature = (dr["Feature"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Feature"], typeof(string));
                obj.Shortdescr = (dr["Shortdescr"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Shortdescr"], typeof(string));
                obj.Price = (dr["Price"] == Convert.DBNull) ? 0 : (double)Convert.ChangeType(dr["Price"], typeof(double));
                obj.Nowprice = (dr["Nowprice"] == Convert.DBNull) ? 0 : (double)Convert.ChangeType(dr["Nowprice"], typeof(double));
                obj.Sore = (dr["Sore"] == Convert.DBNull) ? 0 : (double)Convert.ChangeType(dr["Sore"], typeof(double));
                obj.Keyword = (dr["Keyword"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Keyword"], typeof(string));
                obj.Isfirst = (dr["Isfirst"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Isfirst"], typeof(int));
                obj.Level = (dr["Level"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Level"], typeof(int));
                obj.Createby = (dr["Createby"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Createby"], typeof(string));
                obj.Createdate = (dr["Createdate"] == Convert.DBNull) ? new DateTime(1900, 1, 1) : (DateTime)Convert.ChangeType(dr["Createdate"], typeof(DateTime));
                obj.Lasteupdateby = (dr["Lasteupdateby"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Lasteupdateby"], typeof(string));
                obj.Lasteupdatedate = (dr["Lasteupdatedate"] == Convert.DBNull) ? new DateTime(1900, 1, 1) : (DateTime)Convert.ChangeType(dr["Lasteupdatedate"], typeof(DateTime));
                obj.Licd = (dr["Licd"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Licd"], typeof(int));
                obj.ImgBigPath = (dr["ImgBigPath"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["ImgBigPath"], typeof(string));
                obj.ImgSmaillPath = (dr["ImgSmaillPath"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["ImgSmaillPath"], typeof(string));
                obj.FileListId = (dr["FileListId"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["FileListId"], typeof(int));
                obj.Code = (dr["Code"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Code"], typeof(string));
                obj.MailPrice = (dr["MailPrice"] == Convert.DBNull) ? 0 : (double)Convert.ChangeType(dr["MailPrice"], typeof(double));
                obj.Stocks = (dr["Stocks"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Stocks"], typeof(int));
                obj.Indeximg = (dr["Indeximg"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Indeximg"], typeof(string));
                obj.Otherdescr = (dr["Otherdescr"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Otherdescr"], typeof(string));
            }

            return obj;
        }

        /// <summary>
        /// 将DataRow转换成Purchase对象(默认列名映射为属性名)
        /// </summary>
        /// <returns>Purchase对象</returns>
        public static Purchase Dr2Obj(DataRow dr)
        {
            return Dr2Obj(dr, ColumnNameEnum.DBName);
        }

        /// <summary>
        /// 将DataTabe转换成的Purchase对象集合
        /// </summary>
        /// <param name="dt">由CreateTable生成的DataTable</param>
        /// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
        /// <returns>Purchase对象的集合</returns>
        public static IList Dt2Objs(DataTable dt, ColumnNameEnum cne)
        {
            if (dt == null)
            {
                throw new ArgumentNullException("dt");
            }

            ArrayList alResult = new ArrayList();

            foreach (DataRow dr in dt.Rows)
            {
                alResult.Add(Dr2Obj(dr, cne));
            }

            return alResult;
        }

        /// <summary>
        /// 将DataTabe转换成的Purchase对象集合(默认列名映射为属性名)
        /// </summary>
        /// <param name="dt">由CreateTable生成的DataTable</param>
        /// <returns>Purchase对象的集合</returns>
        public static IList Dt2Objs(DataTable dt)
        {
            return Dt2Objs(dt, ColumnNameEnum.PropertyName);
        }

        /// <summary>
        /// 用objs的Purchase对象集合填充DataTable
        /// </summary>
        /// <param name="dt">由CreateTable生成的DataTable</param>
        /// <param name="objs">Purchase对象集合</param>
        /// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
        public static void FillDataTable(DataTable dt, IList objs, ColumnNameEnum cne)
        {
            if (dt == null)
            {
                throw new ArgumentNullException("dt");
            }
            if (objs == null)
            {
                throw new ArgumentNullException("objs");
            }

            foreach (Purchase obj in objs)
            {
                DataRow dr = dt.NewRow();
                obj.FillDataRow(dr, cne);
                dt.Rows.Add(dr);
            }
        }

        /// <summary>
        /// 用objs的Purchase对象集合填充DataTable(默认列名映射为属性名)
        /// </summary>
        /// <param name="dt">由CreateTable生成的DataTable</param>
        /// <param name="objs">Purchase对象集合</param>
        public static void FillDataTable(DataTable dt, IList objs)
        {
            FillDataTable(dt, objs, ColumnNameEnum.PropertyName);
        }
        #endregion

        /// <summary>
        /// 取消编辑,恢复到上次有效调用BeginEdit前的状态,并清空保留值
        /// </summary>
        public override void CancelEdit()
        {
            Purchase old = this.OldValue as Purchase;
            if (old != null)
            {
                this.Seqno = old.Seqno;
                this.ProductID = old.ProductID;
                this.Title = old.Title;
                this.Type = old.Type;
                this.Descr = old.Descr;
                this.Feature = old.Feature;
                this.Shortdescr = old.Shortdescr;
                this.Price = old.Price;
                this.Nowprice = old.Nowprice;
                this.Sore = old.Sore;
                this.Keyword = old.Keyword;
                this.Isfirst = old.Isfirst;
                this.Level = old.Level;
                this.Createby = old.Createby;
                this.Createdate = old.Createdate;
                this.Lasteupdateby = old.Lasteupdateby;
                this.Lasteupdatedate = old.Lasteupdatedate;
                this.Licd = old.Licd;
                this.ImgBigPath = old.ImgBigPath;
                this.ImgSmaillPath = old.ImgSmaillPath;
                this.FileListId = old.FileListId;
                this.Code = old.Code;
                this.MailPrice = old.MailPrice;
                this.Stocks = old.Stocks;
                this.Indeximg = old.Indeximg;
                this.Otherdescr = old.Otherdescr;
                this.OldValue = null;
            }
        }




        #region Purchase实体的内部Key类
        /// <summary>
        /// Purchase实体的Key类
        /// </summary>
        public sealed class Key
        {

            private int m_Seqno;
            public int Seqno
            {
                get
                {
                    return m_Seqno;
                }
                set
                {
                    m_Seqno = value;
                }
            }

            public Key(int pSeqno)
            {
                m_Seqno = pSeqno;

            }
        }
        #endregion
        /// <summary>
        /// 得到实体Purchase的PK
        /// </summary>
        public Key GetKey()
        {
            return new Key(Seqno);
        }


        #endregion
    }
}
